package com.qzimp.fujiancuo.mapper;

import com.mybatisflex.core.BaseMapper;
import com.qzimp.fujiancuo.entity.Legend;
import com.qzimp.fujiancuo.entity.dto.LegendWithCuoNameDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *  映射层。
 *
 * @author 吴宗波
 * @since 2024-11-21
 */
public interface LegendMapper extends BaseMapper<Legend> {
    @Select("SELECT l.*, c.name AS cuoName " +
            "FROM tb_legend l " +
            "LEFT JOIN tb_cuo c ON l.cuo_id = c.id " +
            "WHERE l.cuo_id = #{cuo_id}")
    List<LegendWithCuoNameDto> selectByCuoId(@Param("cuo_id") Integer cuoId);

}
